<div style="margin: auto">
    <form id="filetype_add_form" class="layui-form layui-form-pane" method="post" th:action="${action}">
        <input type="hidden" name="id" th:value="${filetype.id}">
        <div style="margin: 40px;">
            <div class="layui-form-item">
                <label class="layui-form-label">名称</label>
                <div class="layui-input-block">
                    <input id="filetype_add_name" autocomplete="off" class="layui-input" name="name" lay-verify="required" th:value="${filetype.name}">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">状态</label>
                <div class="layui-input-block">
                    <input id="filetype_add_state" autocomplete="off" class="layui-input" name="state" th:value="${filetype.state}">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label" style="height: 100px;">说明</label>
                <div class="layui-input-block">
                    <textarea placeholder="请输入内容" id="filetype_add_introduce" class="layui-textarea" name="introduce" th:value="${filetype.introduce}" th:text="${filetype.introduce}"></textarea>
                </div>
            </div>
            <div class="layui-footer" style="margin: auto;display:none">
                <button id="filetype_add_submit" type="submit" class="layui-btn" lay-submit lay-filter="filetype_add_submit">立即提交</button>
            </div>
        </div>
    </form>
</div>

<script type="text/javascript">
    $(function () {
        $('#filetype_add_form').submit(function () {
            var action = $(this).attr('action');
            $.ajax({
                url: action,
                type: 'post',
                data: $(this).serialize(),
                success:function(result){
                    if (result.state == "success"){
                        filetype_index_js.data_init();
                        filetype_index_js.item = null;
                        filetype_index_js.layer.close(filetype_index_js.layerIndex);
                        filetype_index_js.layer.msg(result.message);
                    }else {
                        filetype_index_js.layer.msg(result.message);
                    }
                }});
            return false;
        });
    });
</script>